package cn.gzsxt.music.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.gzsxt.music.query.HitSongQueryObject;
import cn.gzsxt.music.service.HitSongService;
import cn.gzsxt.music.vo.MsgObj;

@Controller
@Scope("request")
@RequestMapping("/hitSong")
public class HitSongController {
		
	@Autowired
	private HitSongService service;
	
	@RequestMapping("songList")
	@ResponseBody
	public Map<String, Object> songList(HitSongQueryObject qo) {
		Map<String, Object> result = service.selectSongByCondition(qo);
		return result;		
	}
	
	@RequestMapping("updateHitSong")
	@ResponseBody
	public MsgObj updateHitSong(@RequestParam Map<String, Object> params){
		
		int row = service.updateHitSong(params);
		
		MsgObj msgObj = new MsgObj(0, "保存失败");
		if(row == 1) {
			msgObj = new MsgObj(1, "保存成功");
		}
		return msgObj;
	}
	
	
}
